package com.season.seasonStudy.javase.entity;

public class Users {
	private int id;// 实体类一般添加id,唯一标识,为了sql主键
	private String name;
	private int age;

	public Users(int id, String name, int age) {
		this.id = id;
		this.name = name;
		this.age = age;
	}
	/**
	 * 重写users的hashcode
	 * int.不出来  封装类可以.
	 * 
	 * @Override
	 * 我自己的重写equals方法	一般写好自己的类后,自己最好把equals方法写好
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + id;
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Users other = (Users) obj;
		if (id != other.id)
			return false;
		return true;
	}

	public Users() {
		super();
	}


	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	@Override
	public String toString() {
		return "Users [id=" + id + ", name=" + name + ", age=" + age + "]";
	}

}
